import {Pipe, PipeTransform} from '@angular/core';
import {FieldBase} from '../../pages/dynamic-form/model/FieldBase';

@Pipe({name: 'formItemWidthPipe'})
export class FormItemWidthPipe implements PipeTransform {
  transform(item: FieldBase) {
    if (item.labelWidth === 4 && item.controlWidth === 20) {
      return '整行';
    }
    if (item.labelWidth === 4 && item.controlWidth === 8) {
      return '半行';
    }
    return '标签占位：' + item.labelWidth + '，控件占位：' + item.controlWidth;
  }
}
